<html>
<head>
	 <script type="text/javascript" src="<?php echo base_url() . SKINSPATH; ?>js/jquery/jquery-1.8.3.min.js"></script>
</head>
<body>
	<form method="post">
<p>Username <input name="username" value="<?php if(isset($username)) echo $username;?>" type="text"/></p>
<p>Passwd <input name="passwd" value="<?php if(isset($passwd)) echo $passwd;?>" type="password"/></p>
<p>Function <select name="function" id="function" onchange="set_text(this.value)">
<?php foreach($functions as $key => $value): ?>
<option value="<?php echo $key ?>"<?php if($key == $func) echo 'selected="selected"'?>><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</p>
<p id="p_id" style="display: none"><label id="lid">User Id</label> <input name="id" value="<?php if(isset($id)) echo $id ?>" type="text" /></p>
<p id="p_val1" style="display: none"><label id="l1">First Name</label> <input name="val1" value="<?php if(isset($val1)) echo $val1 ?>" type="text" /></p>
<p id="p_val2" style="display: none"><label id="l2">Last Name</label> <input name="val2" value="<?php if(isset($val2)) echo $val2 ?>" type="text" /></p>
<p id="p_val3" style="display: none"><label id="l3">Middle Name</label> <input name="val3" value="<?php if(isset($val3)) echo $val3 ?>" type="text" /></p>
<p id="p_val4" style="display: none"><label id="l4">Gender</label> <input name="val4" value="<?php if(isset($val4)) echo $val4 ?>" type="text" /></p>
<p id="p_val5" style="display: none"><label id="l5">Address</label> <input name="val5" value="<?php if(isset($val5)) echo $val5 ?>" type="text" /></p>
<p id="p_val6" style="display: none"><label id="l6">House Nnmber</label> <input name="val6" value="<?php if(isset($val6)) echo $val6 ?>" type="text" /></p>
<p id="p_val7" style="display: none"><label id="l7">Post code</label> <input name="val7" value="<?php if(isset($val7)) echo $val7 ?>" type="text" /></p>
<p id="p_val8" style="display: none"><label id="l8">Place</label> <input name="val8" value="<?php if(isset($val8)) echo $val8 ?>" type="text" /></p>
<p id="p_val9" style="display: none"><label id="l9">Email</label> <input name="val9" value="<?php if(isset($val9)) echo $val9 ?>" type="text" /></p>
<p id="p_val10" style="display: none"><label id="l10">Phone</label> <input name="val10" value="<?php if(isset($val10)) echo $val10 ?>" type="text" /></p>
<p id="p_val11" style="display: none"><label id="l11">Birthday</label> <input name="val11" value="<?php if(isset($val11)) echo $val11 ?>" type="text" /></p>
<p id="p_val12" style="display: none"><label id="l12">Password</label> <input name="val12" value="<?php if(isset($val12)) echo $val12 ?>" type="text" /></p>
<p id="p_val13" style="display: none"><label id="l13">Facebookid</label> <input name="val13" value="<?php if(isset($val13)) echo $val13 ?>" type="text" /></p>
<p><input type="submit" name="submit" value="Submit"/></p>
</form>
<?php if(isset($result)) echo $result;?>
</body>
<script type="text/javascript">
function set_text(val) {
	$('#p_id').hide();
	$('#p_val1').hide();
	$('#p_val2').hide();
	$('#p_val3').hide();
	$('#p_val4').hide();
	$('#p_val5').hide();
	$('#p_val6').hide();
	$('#p_val7').hide();
	$('#p_val8').hide();
	$('#p_val9').hide();
	$('#p_val10').hide();
	$('#p_val11').hide();
	$('#p_val12').hide();
	$('#p_val13').hide();

	if(val == 'register') {
		showAll(['p_val1','p_val2']);
		$('#l1').html('Email');
		$('#l2').html('Password');
	} else if(val == 'updateProfile') {
		$('#lid').html('User ID');
		showAll(['p_id','p_val1','p_val2','p_val3','p_val4','p_val5','p_val6','p_val7','p_val8','p_val9','p_val10','p_val11','p_val12']);
		$('#l1').html('First name');
		$('#l2').html('Last name');
		$('#l3').html('Middle Name');
		$('#l4').html('Gender');
		$('#l5').html('Address');
		$('#l6').html('House Number');
	} else if(val == 'addMember') {
		showAll(['p_val1','p_val2','p_val3','p_val4','p_val5','p_val6','p_val7','p_val8','p_val9','p_val10','p_val11']);
		$('#l1').html('First name');
		$('#l2').html('Last name');
		$('#l3').html('Middle Name');
		$('#l4').html('Gender');
		$('#l5').html('Address');
		$('#l6').html('House Number');
	} else if(val == 'updateMember') {
		showAll(['p_id','p_val1','p_val2','p_val3','p_val4','p_val5','p_val6','p_val7','p_val8','p_val9','p_val10','p_val11']);
		$('#lid').html('User ID');
		$('#l1').html('First name');
		$('#l2').html('Last name');
		$('#l3').html('Middle Name');
		$('#l4').html('Gender');
		$('#l5').html('Address');
		$('#l6').html('House Number');
	} else if(val == 'getProfile' || val == "getContract") {
		showAll(['p_id']);	
	} else if(val == 'login') {
		showAll(['p_val1','p_val2','p_val3']);
		$('#l1').html('Email');
		$('#l2').html('Password');
		$('#l3').html('Facebookid');
	} else if(val == 'addContract') {
		showAll(['p_id','p_val1','p_val2','p_val3','p_val4','p_val5','p_val6']);
		$('#lid').html('Member Id');
		$('#l1').html('Contract Number');
		$('#l2').html('Category Id');
		$('#l3').html('Provider Id');
		$('#l4').html('Product Id');
		$('#l5').html('Start date');
		$('#l6').html('end_date');
	} else if(val == 'getListContract') {
		showAll(['p_id']);
		$('#lid').html('Member Id');
	} else if(val == 'setTerminationAlert') {
		showAll(['p_id','p_val1']);
		$('#lid').html('Contract Id');
		$('#l1').html('Termination date (number)');
	} else if(val == 'changeAddress') {
		showAll(['p_id','p_val1','p_val2','p_val3','p_val4']);
		$('#lid').html('Member ID');
		$('#l1').html('Address');
		$('#l2').html('Postcode');
		$('#l3').html('Place');
		$('#l4').html('Date move');
	} else if(val == 'setDeath') {
		$('#lid').show();
		$('#l1').html('Member Id');
	} else if(val == 'sendDocument') {
		showAll(['p_id','p_val1','p_val2','p_val3','p_val4','p_val5']);
		$('#l1').html('Type: 1: moving address;2: death user; 3: termination letter');
		$('#l1').html('Contract Number');
		$('#l2').html('Category Id');
		$('#l3').html('Provider Id');
		$('#l4').html('Product Id');
		$('#l5').html('Member Id');
	} 
}
set_text($('#function').val());

function showAll(arr_ids){
for (id in arr_ids)
  {
  	$('#'+arr_ids[id]).show();
  }
}

</script>
</html>